package com.pond.pond.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pond.common.log.annotation.Log;
import com.pond.common.log.enums.BusinessType;
import com.pond.pond.domain.PondActivityNotice;
import com.pond.pond.service.IPondActivityNoticeService;
import com.pond.common.core.web.controller.BaseController;
import com.pond.common.core.web.domain.AjaxResult;
import com.pond.common.core.utils.poi.ExcelUtil;
import com.pond.common.core.web.page.TableDataInfo;

/**
 * 钓场活动通知Controller
 * 
 * @author ruoyi
 * @date 2025-06-12
 */
@RestController
@RequestMapping("/notice")
public class PondActivityNoticeController extends BaseController
{
    @Autowired
    private IPondActivityNoticeService pondActivityNoticeService;

    /**
     * 查询钓场活动通知列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PondActivityNotice pondActivityNotice)
    {
        startPage();
        List<PondActivityNotice> list = pondActivityNoticeService.selectPondActivityNoticeList(pondActivityNotice);
        return getDataTable(list);
    }

    /**
     * 导出钓场活动通知列表
     */
    @Log(title = "钓场活动通知", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PondActivityNotice pondActivityNotice)
    {
        List<PondActivityNotice> list = pondActivityNoticeService.selectPondActivityNoticeList(pondActivityNotice);
        ExcelUtil<PondActivityNotice> util = new ExcelUtil<PondActivityNotice>(PondActivityNotice.class);
        util.exportExcel(response, list, "钓场活动通知数据");
    }

    /**
     * 获取钓场活动通知详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(pondActivityNoticeService.selectPondActivityNoticeById(id));
    }

    /**
     * 新增钓场活动通知
     */
    @Log(title = "钓场活动通知", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PondActivityNotice pondActivityNotice)
    {
        return toAjax(pondActivityNoticeService.insertPondActivityNotice(pondActivityNotice));
    }

    /**
     * 修改钓场活动通知
     */
    @Log(title = "钓场活动通知", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PondActivityNotice pondActivityNotice)
    {
        return toAjax(pondActivityNoticeService.updatePondActivityNotice(pondActivityNotice));
    }

    /**
     * 删除钓场活动通知
     */
    @Log(title = "钓场活动通知", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(pondActivityNoticeService.deletePondActivityNoticeByIds(ids));
    }
}
